<template>
    <div class="home-header">
        <i class="iconfont icon-fanhui"></i>
        <div class="search-wrapper">
            <i class="iconfont icon-sousuo"></i><input type="text">
        </div>
        <div class="city-wrapper" @click="toCity">
            <span>{{ city.name }}</span><i class="iconfont icon-xiajiantou"></i>
<!--            <router-link to="/city"></router-link>-->
        </div>
    </div>
</template>

<script>
    export default {
        name: "HomeHeader",
        methods: {
            toCity() {
                this.$router.push('/city')
            }
        },
        computed: {
            city() {
               return this.$store.state.currentCity
            }
        }
    }
</script>

<style scoped>

    .home-header {
        position: fixed;
        left: 0;
        top: 0;
        width: 100%;
        height: 50px;
        background: rgb(0,188,212);
        z-index: 10;

        display: flex;
        align-items: center;
    }
    .icon-fanhui {
        color: white;
        font-size: 25px;
        font-weight: bold;
        margin-left: 5px;
    }
    .search-wrapper {
        flex: 1;
        height: 30px;
        position: relative;
        box-sizing: border-box;
        padding-left: 5px;
    }
    .search-wrapper i {
        position: absolute;
        left: 10px;
        top: 8px;
    }
    .search-wrapper input {
        width: 100%;
        height: 100%;
        border: none;
        line-height: 30px;
        border-radius: 3px;
        outline: none;
        padding: 0 25px;
        box-sizing: border-box;
    }

    .city-wrapper {
        text-align: center;
        font-size: 14px;
        width: 70px;
        color: white;
    }

</style>